﻿using System;
using System.IO;
using DeepZoomPivotConstructor.ErrorAndLoggingInterfaces;

namespace Logging
{
    /// <summary>
    /// Simple logger class that sends output to a console.
    /// </summary>
    public class LoggerConsole : IErrorLogger
    {
        private TextWriter _output;

        /// <summary>
        /// Write errors, etc., to stdout
        /// </summary>
        public LoggerConsole()
        {
            _output = Console.Out;
        }

        /// <summary>
        /// Write errors to some other location
        /// </summary>
        /// <param name="outStream"></param>
        public LoggerConsole(TextWriter outStream)
        {
            _output = outStream;
        }

        public void LogMessage(string ID, string message)
        {
            Console.WriteLine("{0} - {1}", ID, message);
        }

        public void LogMessage(string ID, string message, Exception e)
        {
            Console.WriteLine("{0} - {1}: {2} - {3}", ID, message, e.Message, e.StackTrace);
        }

        public void SetLogfileLocation(System.IO.DirectoryInfo newDirectory)
        {
        }
    }
}
